import React, { Component } from 'react';
import dynamic from 'dva/dynamic';
import { Route } from 'dva/router';

export default function goodsDetailRoute(app) {

  const GoodsDetail = dynamic({
    app,
    models: () => {
      return [
        import(/* webpackChunkName: "goodsDetailModel" */'../models/goodsDetail/goodsDetailModel'),
        import(/* webpackChunkName: "recommendModel" */'../models/recommendAndRank/recommendModel'),
        import(/* webpackChunkName: "rankModel" */'../models/recommendAndRank/rankModel'),
        import(/* webpackChunkName: "orderListModel" */'../models/orderList/orderListModel'),
      ];
    },
    component: () => import(/* webpackChunkName: "goodsDetail" */'../routes/goodsDetail/goodsDetail'),
  });


    const Detail = dynamic({
        app,
        models: () => {
            return [
                import(/* webpackChunkName: "goodsDetailModel" */'../models/goodsDetail/goodsDetailModel'),
            ];
        },
        component: () => import(/* webpackChunkName: "detail" */'../routes/goodsDetail/detail'),
    });


    const Coupon = dynamic({
        app,
        models: () => {
            return [
                import(/* webpackChunkName: "goodsDetailModel" */'../models/goodsDetail/goodsDetailModel'),
            ];
        },
        component: () => import(/* webpackChunkName: "goodsDetailCoupon" */'../routes/goodsDetail/coupon'),
    });

  return (
    [
      <Route key="/goodsDetail" exact strict path="/goodsDetail/:specId" component={ GoodsDetail }/>,
      <Route key="/detail" exact strict path="/detail/:specId" component={ Detail }/>,
      <Route key="/goodsDetailCoupon" exact strict path="/goodsDetailCoupon/:storeId" component={ Coupon }/>
    ]
  );
}
